home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / CIncludes / Slots.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-11  |  14.0 KB  |  497 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Slots.h
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a3  ETO #16, MPW prerelease.  Friday, November 11, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. */
  16.  
  17. #ifndef __SLOTS__
  18. #define __SLOTS__
  19.  
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. /*    #include <ConditionalMacros.h>                                */
  25.  
  26. #ifndef __EVENTS__
  27. #include <Events.h>
  28. #endif
  29. /*    #include <Quickdraw.h>                                        */
  30. /*        #include <MixedMode.h>                                    */
  31. /*        #include <QuickdrawText.h>                                */
  32. /*    #include <OSUtils.h>                                        */
  33. /*        #include <Memory.h>                                        */
  34.  
  35. #ifndef __FILES__
  36. #include <Files.h>
  37. #endif
  38.  
  39. #ifdef __cplusplus
  40. extern "C" {
  41. #endif
  42.  
  43. #if GENERATINGPOWERPC
  44. #pragma options align=mac68k
  45. #endif
  46.  
  47. #ifdef __CFM68K__
  48. #pragma lib_export on
  49. #endif
  50.  
  51.  
  52. enum {
  53.     fCardIsChanged                = 1,                            /*Card is Changed field in StatusFlags field of sInfoArray*/
  54.     fCkForSame                    = 0,                            /*For SearchSRT. Flag to check for SAME sResource in the table. */
  55.     fCkForNext                    = 1,                            /*For SearchSRT. Flag to check for NEXT sResource in the table. */
  56.     fWarmStart                    = 2,                            /*If this bit is set then warm start else cold start.*/
  57.     stateNil                    = 0,                            /*State*/
  58.     stateSDMInit                = 1,                            /*:Slot declaration manager Init*/
  59.     statePRAMInit                = 2,                            /*:sPRAM record init*/
  60.     statePInit                    = 3,                            /*:Primary init*/
  61.     stateSInit                    = 4,                            /*:Secondary init*/
  62. /* flags for spParamData */
  63.     fall                        = 0,                            /* bit 0: set=search enabled/disabled sRsrc's */
  64.     foneslot                    = 1,                            /*    1: set=search sRsrc's in given slot only */
  65.     fnext                        = 2                                /*    2: set=search for next sRsrc */
  66. };
  67.  
  68. /*
  69.         SlotIntServiceProcPtr uses register based parameters on the 68k and cannot
  70.         be written in or called from a high-level language without the help of
  71.         mixed mode or assembly glue.
  72.  
  73.         In:
  74.          => sqParameter     A1.L
  75.         Out:
  76.          <= return value    D0.W
  77. */
  78.  
  79. #if GENERATINGCFM
  80. typedef UniversalProcPtr SlotIntServiceUPP;
  81. #else
  82. typedef Register68kProcPtr SlotIntServiceUPP;
  83. #endif
  84.  
  85. enum {
  86.     uppSlotIntServiceProcInfo = kRegisterBased
  87.          | RESULT_SIZE(SIZE_CODE(sizeof(short)))
  88.          | REGISTER_RESULT_LOCATION(kRegisterD0)
  89.          | REGISTER_ROUTINE_PARAMETER(1, kRegisterA1, SIZE_CODE(sizeof(long)))
  90. };
  91.  
  92. #if GENERATINGCFM
  93. #define NewSlotIntServiceProc(userRoutine)        \
  94.         (SlotIntServiceUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppSlotIntServiceProcInfo, GetCurrentArchitecture())
  95. #else
  96. #define NewSlotIntServiceProc(userRoutine)        \
  97.         ((SlotIntServiceUPP) (userRoutine))
  98. #endif
  99.  
  100. #if GENERATINGCFM
  101. #define CallSlotIntServiceProc(userRoutine, sqParameter)        \
  102.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppSlotIntServiceProcInfo, (sqParameter))
  103. #else
  104. /* (*SlotIntServiceProcPtr) cannot be called from a high-level language without the Mixed Mode Manager */
  105. #endif
  106.  
  107. struct SlotIntQElement {
  108.     Ptr                                sqLink;                        /*ptr to next element*/
  109.     short                            sqType;                        /*queue type ID for validity*/
  110.     short                            sqPrio;                        /*priority*/
  111.     SlotIntServiceUPP                sqAddr;                        /*interrupt service routine*/
  112.     long                            sqParm;                        /*optional A1 parameter*/
  113. };
  114. typedef struct SlotIntQElement SlotIntQElement;
  115.  
  116. typedef SlotIntQElement *SQElemPtr;
  117.  
  118. struct SpBlock {
  119.     long                            spResult;                    /*FUNCTION Result*/
  120.     Ptr                                spsPointer;                    /*structure pointer*/
  121.     long                            spSize;                        /*size of structure*/
  122.     long                            spOffsetData;                /*offset/data field used by sOffsetData*/
  123.     Ptr                                spIOFileName;                /*ptr to IOFile name for sDisDrvrName*/
  124.     Ptr                                spsExecPBlk;                /*pointer to sExec parameter block.*/
  125.     long                            spParamData;                /*misc parameter data (formerly spStackPtr).*/
  126.     long                            spMisc;                        /*misc field for SDM.*/
  127.     long                            spReserved;                    /*reserved for future expansion*/
  128.     short                            spIOReserved;                /*Reserved field of Slot Resource Table*/
  129.     short                            spRefNum;                    /*RefNum*/
  130.     short                            spCategory;                    /*sType: Category*/
  131.     short                            spCType;                    /*Type*/
  132.     short                            spDrvrSW;                    /*DrvrSW*/
  133.     short                            spDrvrHW;                    /*DrvrHW*/
  134.     SInt8                            spTBMask;                    /*type bit mask bits 0..3 mask words 0..3*/
  135.     SInt8                            spSlot;                        /*slot number*/
  136.     SInt8                            spID;                        /*structure ID*/
  137.     SInt8                            spExtDev;                    /*ID of the external device*/
  138.     SInt8                            spHwDev;                    /*Id of the hardware device.*/
  139.     SInt8                            spByteLanes;                /*bytelanes from card ROM format block*/
  140.     SInt8                            spFlags;                    /*standard flags*/
  141.     SInt8                            spKey;                        /*Internal use only*/
  142. };
  143. typedef struct SpBlock SpBlock;
  144.  
  145. typedef SpBlock *SpBlockPtr;
  146.  
  147. struct SInfoRecord {
  148.     Ptr                                siDirPtr;                    /*Pointer to directory*/
  149.     short                            siInitStatusA;                /*initialization E*/
  150.     short                            siInitStatusV;                /*status returned by vendor init code*/
  151.     SInt8                            siState;                    /*initialization state*/
  152.     SInt8                            siCPUByteLanes;                /*0=[d0..d7] 1=[d8..d15]*/
  153.     SInt8                            siTopOfROM;                    /*Top of ROM= $FssFFFFx: x is TopOfROM*/
  154.     SInt8                            siStatusFlags;                /*bit 0 - card is changed*/
  155.     short                            siTOConst;                    /*Time Out C for BusErr*/
  156.     SInt8                            siReserved[2];                /*reserved*/
  157.     Ptr                                siROMAddr;                    /* addr of top of ROM */
  158.     SInt8                            siSlot;                        /* slot number */
  159.     SInt8                            siPadding[3];                /* reserved */
  160. };
  161. typedef struct SInfoRecord SInfoRecord;
  162.  
  163. typedef SInfoRecord *SInfoRecPtr;
  164.  
  165. struct SDMRecord {
  166.     ProcPtr                            sdBEVSave;                    /*Save old BusErr vector*/
  167.     ProcPtr                            sdBusErrProc;                /*Go here to determine if it is a BusErr*/
  168.     ProcPtr                            sdErrorEntry;                /*Go here if BusErrProc finds real BusErr*/
  169.     long                            sdReserved;                    /*Reserved*/
  170. };
  171. typedef struct SDMRecord SDMRecord;
  172.  
  173. struct FHeaderRec {
  174.     long                            fhDirOffset;                /*offset to directory*/
  175.     long                            fhLength;                    /*length of ROM*/
  176.     long                            fhCRC;                        /*CRC*/
  177.     SInt8                            fhROMRev;                    /*revision of ROM*/
  178.     SInt8                            fhFormat;                    /*format - 2*/
  179.     long                            fhTstPat;                    /*test pattern*/
  180.     SInt8                            fhReserved;                    /*reserved*/
  181.     SInt8                            fhByteLanes;                /*ByteLanes*/
  182. };
  183. typedef struct FHeaderRec FHeaderRec;
  184.  
  185. typedef FHeaderRec *FHeaderRecPtr;
  186.  
  187. struct SEBlock {
  188.     UInt8                            seSlot;                        /*Slot number.*/
  189.     UInt8                            sesRsrcId;                    /*sResource Id.*/
  190.     short                            seStatus;                    /*Status of code executed by sExec.*/
  191.     UInt8                            seFlags;                    /*Flags*/
  192.     UInt8                            seFiller0;                    /*Filler, must be SignedByte to align on odd boundry*/
  193.     UInt8                            seFiller1;                    /*Filler*/
  194.     UInt8                            seFiller2;                    /*Filler*/
  195.     long                            seResult;                    /*Result of sLoad.*/
  196.     long                            seIOFileName;                /*Pointer to IOFile name.*/
  197.     UInt8                            seDevice;                    /*Which device to read from.*/
  198.     UInt8                            sePartition;                /*The partition.*/
  199.     UInt8                            seOSType;                    /*Type of OS.*/
  200.     UInt8                            seReserved;                    /*Reserved field.*/
  201.     UInt8                            seRefNum;                    /*RefNum of the driver.*/
  202.     UInt8                            seNumDevices;                /* Number of devices to load.*/
  203.     UInt8                            seBootState;                /*State of StartBoot code.*/
  204.     SInt8                            filler;
  205. };
  206. typedef struct SEBlock SEBlock;
  207.  
  208. /*  Principle  */
  209.  
  210. #if !GENERATINGCFM
  211. #pragma parameter __D0 SReadByte(__A0)
  212. #endif
  213. extern pascal OSErr SReadByte(SpBlockPtr spBlkPtr)
  214.  TWOWORDINLINE(0x7000, 0xA06E);
  215.  
  216. #if !GENERATINGCFM
  217. #pragma parameter __D0 SReadWord(__A0)
  218. #endif
  219. extern pascal OSErr SReadWord(SpBlockPtr spBlkPtr)
  220.  TWOWORDINLINE(0x7001, 0xA06E);
  221.  
  222. #if !GENERATINGCFM
  223. #pragma parameter __D0 SReadLong(__A0)
  224. #endif
  225. extern pascal OSErr SReadLong(SpBlockPtr spBlkPtr)
  226.  TWOWORDINLINE(0x7002, 0xA06E);
  227.  
  228. #if !GENERATINGCFM
  229. #pragma parameter __D0 SGetCString(__A0)
  230. #endif
  231. extern pascal OSErr SGetCString(SpBlockPtr spBlkPtr)
  232.  TWOWORDINLINE(0x7003, 0xA06E);
  233.  
  234. #if !GENERATINGCFM
  235. #pragma parameter __D0 SGetBlock(__A0)
  236. #endif
  237. extern pascal OSErr SGetBlock(SpBlockPtr spBlkPtr)
  238.  TWOWORDINLINE(0x7005, 0xA06E);
  239.  
  240. #if !GENERATINGCFM
  241. #pragma parameter __D0 SFindStruct(__A0)
  242. #endif
  243. extern pascal OSErr SFindStruct(SpBlockPtr spBlkPtr)
  244.  TWOWORDINLINE(0x7006, 0xA06E);
  245.  
  246. #if !GENERATINGCFM
  247. #pragma parameter __D0 SReadStruct(__A0)
  248. #endif
  249. extern pascal OSErr SReadStruct(SpBlockPtr spBlkPtr)
  250.  TWOWORDINLINE(0x7007, 0xA06E);
  251. /*  Special  */
  252.  
  253. #if !GENERATINGCFM
  254. #pragma parameter __D0 SReadInfo(__A0)
  255. #endif
  256. extern pascal OSErr SReadInfo(SpBlockPtr spBlkPtr)
  257.  TWOWORDINLINE(0x7010, 0xA06E);
  258.  
  259. #if !GENERATINGCFM
  260. #pragma parameter __D0 SReadPRAMRec(__A0)
  261. #endif
  262. extern pascal OSErr SReadPRAMRec(SpBlockPtr spBlkPtr)
  263.  TWOWORDINLINE(0x7011, 0xA06E);
  264.  
  265. #if !GENERATINGCFM
  266. #pragma parameter __D0 SPutPRAMRec(__A0)
  267. #endif
  268. extern pascal OSErr SPutPRAMRec(SpBlockPtr spBlkPtr)
  269.  TWOWORDINLINE(0x7012, 0xA06E);
  270.  
  271. #if !GENERATINGCFM
  272. #pragma parameter __D0 SReadFHeader(__A0)
  273. #endif
  274. extern pascal OSErr SReadFHeader(SpBlockPtr spBlkPtr)
  275.  TWOWORDINLINE(0x7013, 0xA06E);
  276.  
  277. #if !GENERATINGCFM
  278. #pragma parameter __D0 SNextSRsrc(__A0)
  279. #endif
  280. extern pascal OSErr SNextSRsrc(SpBlockPtr spBlkPtr)
  281.  TWOWORDINLINE(0x7014, 0xA06E);
  282.  
  283. #if !GENERATINGCFM
  284. #pragma parameter __D0 SNextTypeSRsrc(__A0)
  285. #endif
  286. extern pascal OSErr SNextTypeSRsrc(SpBlockPtr spBlkPtr)
  287.  TWOWORDINLINE(0x7015, 0xA06E);
  288.  
  289. #if !GENERATINGCFM
  290. #pragma parameter __D0 SRsrcInfo(__A0)
  291. #endif
  292. extern pascal OSErr SRsrcInfo(SpBlockPtr spBlkPtr)
  293.  TWOWORDINLINE(0x7016, 0xA06E);
  294.  
  295. #if !GENERATINGCFM
  296. #pragma parameter __D0 SCkCardStat(__A0)
  297. #endif
  298. extern pascal OSErr SCkCardStat(SpBlockPtr spBlkPtr)
  299.  TWOWORDINLINE(0x7018, 0xA06E);
  300.  
  301. #if !GENERATINGCFM
  302. #pragma parameter __D0 SReadDrvrName(__A0)
  303. #endif
  304. extern pascal OSErr SReadDrvrName(SpBlockPtr spBlkPtr)
  305.  TWOWORDINLINE(0x7019, 0xA06E);
  306.  
  307. #if !GENERATINGCFM
  308. #pragma parameter __D0 SFindDevBase(__A0)
  309. #endif
  310. extern pascal OSErr SFindDevBase(SpBlockPtr spBlkPtr)
  311.  TWOWORDINLINE(0x701B, 0xA06E);
  312.  
  313. #if !GENERATINGCFM
  314. #pragma parameter __D0 SFindBigDevBase(__A0)
  315. #endif
  316. extern pascal OSErr SFindBigDevBase(SpBlockPtr spBlkPtr)
  317.  TWOWORDINLINE(0x701C, 0xA06E);
  318. /*  Advanced  */
  319.  
  320. #if !GENERATINGCFM
  321. #pragma parameter __D0 InitSDeclMgr(__A0)
  322. #endif
  323. extern pascal OSErr InitSDeclMgr(SpBlockPtr spBlkPtr)
  324.  TWOWORDINLINE(0x7020, 0xA06E);
  325.  
  326. #if !GENERATINGCFM
  327. #pragma parameter __D0 SPrimaryInit(__A0)
  328. #endif
  329. extern pascal OSErr SPrimaryInit(SpBlockPtr spBlkPtr)
  330.  TWOWORDINLINE(0x7021, 0xA06E);
  331.  
  332. #if !GENERATINGCFM
  333. #pragma parameter __D0 SCardChanged(__A0)
  334. #endif
  335. extern pascal OSErr SCardChanged(SpBlockPtr spBlkPtr)
  336.  TWOWORDINLINE(0x7022, 0xA06E);
  337.  
  338. #if !GENERATINGCFM
  339. #pragma parameter __D0 SExec(__A0)
  340. #endif
  341. extern pascal OSErr SExec(SpBlockPtr spBlkPtr)
  342.  TWOWORDINLINE(0x7023, 0xA06E);
  343.  
  344. #if !GENERATINGCFM
  345. #pragma parameter __D0 SOffsetData(__A0)
  346. #endif
  347. extern pascal OSErr SOffsetData(SpBlockPtr spBlkPtr)
  348.  TWOWORDINLINE(0x7024, 0xA06E);
  349.  
  350. #if !GENERATINGCFM
  351. #pragma parameter __D0 SInitPRAMRecs(__A0)
  352. #endif
  353. extern pascal OSErr SInitPRAMRecs(SpBlockPtr spBlkPtr)
  354.  TWOWORDINLINE(0x7025, 0xA06E);
  355.  
  356. #if !GENERATINGCFM
  357. #pragma parameter __D0 SReadPBSize(__A0)
  358. #endif
  359. extern pascal OSErr SReadPBSize(SpBlockPtr spBlkPtr)
  360.  TWOWORDINLINE(0x7026, 0xA06E);
  361.  
  362. #if !GENERATINGCFM
  363. #pragma parameter __D0 SCalcStep(__A0)
  364. #endif
  365. extern pascal OSErr SCalcStep(SpBlockPtr spBlkPtr)
  366.  TWOWORDINLINE(0x7028, 0xA06E);
  367.  
  368. #if !GENERATINGCFM
  369. #pragma parameter __D0 SInitSRsrcTable(__A0)
  370. #endif
  371. extern pascal OSErr SInitSRsrcTable(SpBlockPtr spBlkPtr)
  372.  TWOWORDINLINE(0x7029, 0xA06E);
  373.  
  374. #if !GENERATINGCFM
  375. #pragma parameter __D0 SSearchSRT(__A0)
  376. #endif
  377. extern pascal OSErr SSearchSRT(SpBlockPtr spBlkPtr)
  378.  TWOWORDINLINE(0x702A, 0xA06E);
  379.  
  380. #if !GENERATINGCFM
  381. #pragma parameter __D0 SUpdateSRT(__A0)
  382. #endif
  383. extern pascal OSErr SUpdateSRT(SpBlockPtr spBlkPtr)
  384.  TWOWORDINLINE(0x702B, 0xA06E);
  385.  
  386. #if !GENERATINGCFM
  387. #pragma parameter __D0 SCalcSPointer(__A0)
  388. #endif
  389. extern pascal OSErr SCalcSPointer(SpBlockPtr spBlkPtr)
  390.  TWOWORDINLINE(0x702C, 0xA06E);
  391.  
  392. #if !GENERATINGCFM
  393. #pragma parameter __D0 SGetDriver(__A0)
  394. #endif
  395. extern pascal OSErr SGetDriver(SpBlockPtr spBlkPtr)
  396.  TWOWORDINLINE(0x702D, 0xA06E);
  397.  
  398. #if !GENERATINGCFM
  399. #pragma parameter __D0 SPtrToSlot(__A0)
  400. #endif
  401. extern pascal OSErr SPtrToSlot(SpBlockPtr spBlkPtr)
  402.  TWOWORDINLINE(0x702E, 0xA06E);
  403.  
  404. #if !GENERATINGCFM
  405. #pragma parameter __D0 SFindSInfoRecPtr(__A0)
  406. #endif
  407. extern pascal OSErr SFindSInfoRecPtr(SpBlockPtr spBlkPtr)
  408.  TWOWORDINLINE(0x702F, 0xA06E);
  409.  
  410. #if !GENERATINGCFM
  411. #pragma parameter __D0 SFindSRsrcPtr(__A0)
  412. #endif
  413. extern pascal OSErr SFindSRsrcPtr(SpBlockPtr spBlkPtr)
  414.  TWOWORDINLINE(0x7030, 0xA06E);
  415.  
  416. #if !GENERATINGCFM
  417. #pragma parameter __D0 SDeleteSRTRec(__A0)
  418. #endif
  419. extern pascal OSErr SDeleteSRTRec(SpBlockPtr spBlkPtr)
  420.  TWOWORDINLINE(0x7031, 0xA06E);
  421. extern pascal OSErr OpenSlot(ParmBlkPtr paramBlock, Boolean async);
  422.  
  423. #if !GENERATINGCFM
  424. #pragma parameter __D0 OpenSlotSync(__A0)
  425. #endif
  426. extern pascal OSErr OpenSlotSync(ParmBlkPtr paramBlock)
  427.  ONEWORDINLINE(0xA200);
  428.  
  429. #if !GENERATINGCFM
  430. #pragma parameter __D0 OpenSlotAsync(__A0)
  431. #endif
  432. extern pascal OSErr OpenSlotAsync(ParmBlkPtr paramBlock)
  433.  ONEWORDINLINE(0xA600);
  434. /*  Device Manager Slot Support  */
  435.  
  436. #if !GENERATINGCFM
  437. #pragma parameter __D0 SIntInstall(__A0, __D0)
  438. #endif
  439. extern pascal OSErr SIntInstall(SQElemPtr sIntQElemPtr, short theSlot)
  440.  ONEWORDINLINE(0xA075);
  441.  
  442. #if !GENERATINGCFM
  443. #pragma parameter __D0 SIntRemove(__A0, __D0)
  444. #endif
  445. extern pascal OSErr SIntRemove(SQElemPtr sIntQElemPtr, short theSlot)
  446.  ONEWORDINLINE(0xA076);
  447.  
  448. #if !GENERATINGCFM
  449. #pragma parameter __D0 SVersion(__A0)
  450. #endif
  451. extern pascal OSErr SVersion(SpBlockPtr spBlkPtr)
  452.  TWOWORDINLINE(0x7008, 0xA06E);
  453.  
  454. #if !GENERATINGCFM
  455. #pragma parameter __D0 SetSRsrcState(__A0)
  456. #endif
  457. extern pascal OSErr SetSRsrcState(SpBlockPtr spBlkPtr)
  458.  TWOWORDINLINE(0x7009, 0xA06E);
  459.  
  460. #if !GENERATINGCFM
  461. #pragma parameter __D0 InsertSRTRec(__A0)
  462. #endif
  463. extern pascal OSErr InsertSRTRec(SpBlockPtr spBlkPtr)
  464.  TWOWORDINLINE(0x700A, 0xA06E);
  465.  
  466. #if !GENERATINGCFM
  467. #pragma parameter __D0 SGetSRsrc(__A0)
  468. #endif
  469. extern pascal OSErr SGetSRsrc(SpBlockPtr spBlkPtr)
  470.  TWOWORDINLINE(0x700B, 0xA06E);
  471.  
  472. #if !GENERATINGCFM
  473. #pragma parameter __D0 SGetTypeSRsrc(__A0)
  474. #endif
  475. extern pascal OSErr SGetTypeSRsrc(SpBlockPtr spBlkPtr)
  476.  TWOWORDINLINE(0x700C, 0xA06E);
  477.  
  478. #if !GENERATINGCFM
  479. #pragma parameter __D0 SGetSRsrcPtr(__A0)
  480. #endif
  481. extern pascal OSErr SGetSRsrcPtr(SpBlockPtr spBlkPtr)
  482.  TWOWORDINLINE(0x701D, 0xA06E);
  483.  
  484. #ifdef __CFM68K__
  485. #pragma lib_export off
  486. #endif
  487.  
  488. #if GENERATINGPOWERPC
  489. #pragma options align=reset
  490. #endif
  491.  
  492. #ifdef __cplusplus
  493. }
  494. #endif
  495.  
  496. #endif /* __SLOTS__ */
  497.